Prevent glibc dlopen leak at thread exit#128
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the pthread-based threadpool worker thread exit path to return from the thread start routine instead of calling pthread_exit(NULL), aligning with the goal of avoiding a glibc thread-exit unwind path that can allocate via dlopen and not free that memory.
Changes:
- Replaced
pthread_exit(NULL)withreturn NULL;inthreadpool_do_work.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #128 +/- ##
==========================================
+ Coverage 58.57% 63.83% +5.26%
==========================================
Files 32 34 +2
Lines 2607 2912 +305
Branches 526 546 +20
==========================================
+ Hits 1527 1859 +332
+ Misses 745 707 -38
- Partials 335 346 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Returning NULL from the thread function is equivalent to pthread_exit(NULL) but avoids the glibc unwind link path that allocates memory via dlopen which is never freed.
ecb609a to
6569bde
Compare
|
Bump. |
|
FYI. This was not a real leak. It was re-used by next |
Returning
NULLfrom the thread function is equivalent topthread_exit(NULL)but avoids the glibc unwind link path that allocates memory viadlopenwhich is never freed.